/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package org.asistente.entidades;

import java.io.Serializable;
import java.util.Collection;
import java.util.Date;
import javax.persistence.*;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author Wizard
 */
@Entity
@Table(name = "hd_tickets")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "HdTickets.findAll", query = "SELECT h FROM HdTickets h"),
    @NamedQuery(name = "HdTickets.findByCodTicket", query = "SELECT h FROM HdTickets h WHERE h.codTicket = :codTicket"),
    @NamedQuery(name = "HdTickets.findByDescTicket", query = "SELECT h FROM HdTickets h WHERE h.descTicket = :descTicket"),
    @NamedQuery(name = "HdTickets.findByFecResolucion", query = "SELECT h FROM HdTickets h WHERE h.fecResolucion = :fecResolucion"),
    @NamedQuery(name = "HdTickets.findByFecResolucionReal", query = "SELECT h FROM HdTickets h WHERE h.fecResolucionReal = :fecResolucionReal"),
    @NamedQuery(name = "HdTickets.findByFecRegistro", query = "SELECT h FROM HdTickets h WHERE h.fecRegistro = :fecRegistro")})
public class HdTickets implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @NotNull
    @Column(name = "COD_TICKET")
    private Integer codTicket;
    @Size(max = 200)
    @Column(name = "DESC_TICKET")
    private String descTicket;
    @Column(name = "FEC_RESOLUCION")
    @Temporal(TemporalType.TIMESTAMP)
    private Date fecResolucion;
    @Column(name = "FEC_RESOLUCION_REAL")
    @Temporal(TemporalType.TIMESTAMP)
    private Date fecResolucionReal;
    @Column(name = "FEC_REGISTRO")
    @Temporal(TemporalType.TIMESTAMP)
    private Date fecRegistro;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "hdTickets", fetch = FetchType.LAZY)
    private Collection<HdDetalleTicket> hdDetalleTicketCollection;
    @JoinColumn(name = "COD_SOLICITANTE", referencedColumnName = "COD_USUARIO")
    @ManyToOne(fetch = FetchType.LAZY)
    private HdUsuarios codSolicitante;
    @JoinColumn(name = "COD_ASESOR", referencedColumnName = "COD_ASESOR")
    @ManyToOne(fetch = FetchType.LAZY)
    private HdAsesor codAsesor;
    @JoinColumn(name = "COD_ESTADO", referencedColumnName = "COD_ESTADO")
    @ManyToOne(fetch = FetchType.LAZY)
    private HdEstados codEstado;
    @JoinColumn(name = "COD_NIVEL3", referencedColumnName = "COD_NIVEL3")
    @ManyToOne(fetch = FetchType.LAZY)
    private HdClasificacionBaja codNivel3;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "hdTickets", fetch = FetchType.LAZY)
    private Collection<HdHistorial> hdHistorialCollection;

    public HdTickets() {
    }

    public HdTickets(Integer codTicket) {
        this.codTicket = codTicket;
    }

    public Integer getCodTicket() {
        return codTicket;
    }

    public void setCodTicket(Integer codTicket) {
        this.codTicket = codTicket;
    }

    public String getDescTicket() {
        return descTicket;
    }

    public void setDescTicket(String descTicket) {
        this.descTicket = descTicket;
    }

    public Date getFecResolucion() {
        return fecResolucion;
    }

    public void setFecResolucion(Date fecResolucion) {
        this.fecResolucion = fecResolucion;
    }

    public Date getFecResolucionReal() {
        return fecResolucionReal;
    }

    public void setFecResolucionReal(Date fecResolucionReal) {
        this.fecResolucionReal = fecResolucionReal;
    }

    public Date getFecRegistro() {
        return fecRegistro;
    }

    public void setFecRegistro(Date fecRegistro) {
        this.fecRegistro = fecRegistro;
    }

    @XmlTransient
    public Collection<HdDetalleTicket> getHdDetalleTicketCollection() {
        return hdDetalleTicketCollection;
    }

    public void setHdDetalleTicketCollection(Collection<HdDetalleTicket> hdDetalleTicketCollection) {
        this.hdDetalleTicketCollection = hdDetalleTicketCollection;
    }

    public HdUsuarios getCodSolicitante() {
        return codSolicitante;
    }

    public void setCodSolicitante(HdUsuarios codSolicitante) {
        this.codSolicitante = codSolicitante;
    }

    public HdAsesor getCodAsesor() {
        return codAsesor;
    }

    public void setCodAsesor(HdAsesor codAsesor) {
        this.codAsesor = codAsesor;
    }

    public HdEstados getCodEstado() {
        return codEstado;
    }

    public void setCodEstado(HdEstados codEstado) {
        this.codEstado = codEstado;
    }

    public HdClasificacionBaja getCodNivel3() {
        return codNivel3;
    }

    public void setCodNivel3(HdClasificacionBaja codNivel3) {
        this.codNivel3 = codNivel3;
    }

    @XmlTransient
    public Collection<HdHistorial> getHdHistorialCollection() {
        return hdHistorialCollection;
    }

    public void setHdHistorialCollection(Collection<HdHistorial> hdHistorialCollection) {
        this.hdHistorialCollection = hdHistorialCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (codTicket != null ? codTicket.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof HdTickets)) {
            return false;
        }
        HdTickets other = (HdTickets) object;
        if ((this.codTicket == null && other.codTicket != null) || (this.codTicket != null && !this.codTicket.equals(other.codTicket))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "org.asistente.DAO.HdTickets[ codTicket=" + codTicket + " ]";
    }
    
}
